package com.bdqn.boot.yuanshen.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author 周宏锦
 * @Description CORS配置（解决跨域问题）
 * @Date 2025/4/7 21:39
 * @Version 1.0
 */
@Configuration
public class CorsConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*") // 生产环境替换为小程序域名
                .allowedMethods("*")
                .allowedHeaders("*")
                .allowCredentials(true);
    }
}